package com.dp.show.www;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.lib.showfield.helper.AddCustomViewHelper;
import com.lib.showfield.helper.ControllerInitHelper;
import com.lib.showfield.helper.LiveInfoHelper;
import com.lib.showfield.interfaces.AddCustomViewListener;
import com.lib.showfield.interfaces.OnControllerInitListener;

public class HomeFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_home, null, false);
        initView();
        initData();
        return view;
    }

    protected void initView() {

    }

    protected void initData() {
        ControllerInitHelper.getInstance().setOnControllerInitListener(new OnControllerInitListener() {
            @Override
            public void initFinish() {
                AddCustomViewHelper.getInstance().addView(new Button(getContext()));

            }
        });

    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        getView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                LiveInfoHelper.getInstance(getActivity()).getLiveInfo("132541");

            }
        });

    }
}
